package com.cn.demo.service.impl;

import com.cn.demo.service.PageInfoUtilServer;
import com.github.pagehelper.PageInfo;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service
public class PageInfoUtilServerImp implements PageInfoUtilServer {

    /**
     * 分页
     * @param object
     * @return
     */
    @Override
    public Map<String ,Object> currency(Object object) {
        PageInfo pageInfo = new PageInfo((List) object);
        long total = pageInfo.getTotal();
        object = pageInfo.getList();
        Map<String,Object> map = new HashMap<>();
        map.put("total",total);
        map.put("list",object);
        return map;
    }
}
